<template>
  <div class="content-container">
    <div class="panel">
      <div class="content-list">
        <div class="content-item" :key="index" v-for="(item,index) in recordStageList">
          <div class="title">
            <div class="title-desc">接待员：{{ item.htyhmc }}</div>
            <div class="position-desc">{{ item.zzms00 }}</div>
          </div>
          <div class="title" style="justify-content: end;">
            <el-button type="success" @click="handleVideo(item)">开始视频通话</el-button>
          </div>
        </div>
        <empty-data-panel v-if="recordStageList.length===0" msg="暂无数据"></empty-data-panel>
      </div>


    </div>

  </div>
</template>

<script>
import {windowDirectApi} from "@/api/index.js"
import {getUser} from "@/utils/auth.js";

export default {
  name: "window-direct",
  data() {
    return {
      queryParam: {
        yzxh00: sessionStorage.getItem("yzxh"),
      },
      recordStageList: [],
      videoInfoVo: {}
    }
  },
  created() {
    this.queryRecordStageList()
  },
  methods: {
    queryRecordStageList() {
      windowDirectApi.queryRecordStageList({...this.queryParam}).then(res => {
        if (res.data.stageList) {
          this.recordStageList = res.data.stageList
          this.videoInfoVo = res.data.videoInfoVo
        }
      })
    },
    handleVideo(item) {
//   let yzxh=sessionStorage.getItem("yzxh")
      let videoServerIp = this.videoInfoVo.ip
      let videoServerPort = this.videoInfoVo.port
      let sourceUser = getUser().sjhm00
      let targetUser = item.htyhsj
      let deviceType = "hp"
      console.log("videoInfoVo",this.videoInfoVo)
      window.android.startVideoChat(videoServerIp, videoServerPort, sourceUser, targetUser, deviceType)
    }
  }
}
</script>

<style scoped lang="scss">
.panel {

  width: 100%;
  height: 100%;

  .menu-bar {
    display: flex;
    height: 64px;
    width: 70%;
    margin: 40px auto 0 auto;
    justify-content: space-between;

    .menu {
      cursor: pointer;
      //  margin-right: 150px;
      width: 180px;
      height: 63px;
      line-height: 20px;
      border-radius: 16px;
      background-color: rgba(0, 41, 109, 0.3);
      color: rgba(16, 16, 16, 1);
      text-align: center;
      font-family: Roboto;
      //  border: 1px solid rgba(187,187,187,1);
      .title {
        margin-top: 20px;
        font-size: 26px;
        color: white;
      }

    }
  }

  .content-list {
    min-height: 600px;
    width: 70%;
    margin: 30px auto 2px auto;
    border-radius: 12px;
    border: 1px solid rgb(209, 207, 207);

    .content-item {
      cursor: pointer;
      border-radius: 4px;
      height: 50px;
      width: 100%;
      margin: 20px auto auto auto;
      // background-color: white;
      display: flex;

      .brace-left {
        width: 20px;
        height: 54px;
        margin-top: -2px;
        margin-left: -3px;
      }

      .title {
        flex: 1;
        height: 100%;
        display: flex;
        border-bottom: 1px solid rgb(0, 148, 247);

        .title-desc {
          padding-left: 30px;
          font-size: 22px;
          line-height: 50px;
          height: 100%;
          color: rgb(246, 242, 242);
          flex: 1;
          text-align: left;
        }
        .position-desc{
          padding-left: 30px;
          font-size: 22px;
          line-height: 50px;
          height: 100%;
          color: rgb(246, 242, 242);
          text-align: left;
        }

        .title-date {
          line-height: 50px;
          font-size: 22px;
          height: 100%;
          color: rgb(246, 242, 242);
        }
      }

      .brace-right {
        width: 20px;
        height: 54px;
        margin-top: -2px;
      }

    }
  }
}
</style>
